<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%
    String path = request.getContextPath(); //web项目的根路径
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script>
function child(data){
	  $("#fenceId").val(data.fenceId);
	  $("#deviceId").val(data.deviceId);
	  $("#memberId").val(data.memberId);
	  $("#lat").val(data.latLatitude);
	  $("#lng").val(data.lngLongitude);
	  $("#radius").val(data.radius);
      $("#time").val(data.fenceTime);
	  }
</script>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" lng="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <deviceId>编辑</deviceId>
    <link rel="stylesheet" href="<%= basePath %>static/layui2.4.5/css/layui.css" media="all">
  <script src="<%= basePath %>static/jquery/jquery.min.js"></script>  
  <script src="<%= basePath %>static/layui2.4.5/layui.js"></script>
  <script src="<%= basePath %>static/layui2.4.5/lay/modules/layer.js"></script>
  <style>
    body{margin: 10px;}
    .demo-carousel{height: 600px; line-height: 200px; text-align: center;}
    /* .lng{width:500px} */
  </style>
   <script>
 layui.use('form', function(){
    var form = layui.form;
    form.on('submit(go)', function(data){
    console.log(data.field) //当前容器的全部表单字段，名值对形式：{name: value}
	$.ajax({  
  	type : "post",//提交方式  
  	url : "<%=basePath %>monitor/changefence",   //更新公告数据接口
      // int FenceId=Integer.parseInt(request.getParameter("FenceId"));
      // int ByDevice=Integer.parseInt( request.getParameter("ByDevice"));
      // int ByMember=Integer.parseInt( request.getParameter("ByMember"));
      // Double lat=Double.parseDouble(request.getParameter("X"));
      // Double lng=Double.parseDouble(request.getParameter("Y"));
      // Double Radius=Double.parseDouble(request.getParameter("Radius"));
      // $("#fenceId").val(data.FENCE_ID);
      // $("#deviceId").val(data.DEVICE_ID);
      // $("#memberId").val(data.MEMBER_ID);
      // $("#lat").val(data.LAT_LATITUDE);
      // $("#lng").val(data.LNG_LONGITUDE);
      // $("#radius").val(data.RADIUS);
      // $("#time").val(data.FENCE_TIME);
  	data : {"FenceId":$("#fenceId").val(),"ByDevice":$("#deviceId").val(),"ByMember":$("memberId").val(),"X":$("lat").val(),"Y":$("lng").val(),"Radius":$("radius").val()},//数据，必须为 Key/Value 格式
	//data:data.field,    //updateByUserId
  	success : function(result) { //返回数据根据结果进行相应的处理 
  	if (result.success) {
			parent.layer.msg("修改完成",{icon:6})
			var index=parent.layer.getFrameIndex(window.name)
			parent.layer.close(index)
			parent.$(".layui-laypage-btn").click()
		}else {
			layer.alert("修改失败请重试")
		}
	},
	error:function(resule){
		layer.alert("请重试")
  	}  
  });
  });});

 </script>
</head>
<body>
<form>
  <div class="layui-form-item" style="display:none">
    <label class="layui-form-label">ID</label>
    <div class="layui-input-inline">
      <input type="text" name="fenceId" id="fenceId"  readOnly="true" lay-verify="required"  autocomplete="off" class="layui-input" >
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">绑定设备</label>
    <div class="layui-input-inline">
      <input type="text" name="deviceId" id="deviceId"  readOnly="true" lay-verify="required"  autocomplete="off" class="layui-input">
    </div>
  </div>
    <div class="layui-form-item">
    <label class="layui-form-label">时间</label>
    <div class="layui-input-inline">
      <input type="text" name="time" id="time" readOnly="true" lay-verify="required"  autocomplete="off" class="layui-input">
    </div>
  </div>
    <div class="layui-form-item">
    <label class="layui-form-label">绑定用户</label>
    <div class="layui-input-inline">
      <input type="text" name="memberId" id="memberId" readOnly="true"  lay-verify="required"  autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">经度</label>
    <div class="layui-input-inline">
      <input type="text" name="lat" id="lat"  lay-verify="required"  autocomplete="off" class="layui-input">
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">纬度</label>
    <div class="layui-input-block">
      <textarea name="lng" id="lng" class="layui-textarea"></textarea>
    </div>
  </div>
  <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">半径</label>
    <div class="layui-input-block">
      <textarea name="radius" id="radius" class="layui-textarea"></textarea>
    </div>
  </div>
  <input type="button" button lay-submit lay-filter="go" value="编辑" class="layui-btn" style="margin-left: 110px;">
</form>

  


</body>
</html>